<?
	require_once "../../_func/__Global.php";
	require_once "../../_func/__Local.php";
	require_once "../../_func/__MysqlFunc.php";
	require_once "../../_func/_BoardFunc.php";
	require_once "../../_func/_MngFunc.php";
	require_once "../../_func/_CodeFunc.php";
	$db = new MySQLConnection();
	$db->connect();
	$memo_idx = $_GET['memo_idx'];


	$sql = "select
			  memo_idx,
			  rcv_idx,
			  snd_idx,
			  message,
			  cfrm_dt,
			  snd_dt,
			  (SELECT MEMBER_ID from TB_MEMBER where MEMBER_SEQ= BRD_MEMO.rcv_idx) as rcv_id,
			  (SELECT MEMBER_ID from TB_MEMBER where MEMBER_SEQ= BRD_MEMO.snd_idx) as snd_id
			 from BRD_MEMO where memo_idx='$memo_idx'";
	$sth  = $db->query($sql);
	$row = mysql_fetch_array($sth);
	//수신확인
	if(ereg('0000-00-00',$row['cfrm_dt']) && $row['snd_idx'] != $session->getString("userno") && $session->getString("userno")  != ''){
		$sql = "update BRD_MEMO set cfrm_dt= now() where memo_idx='$memo_idx'";
		$db->query($sql);
	}

	//자기글인경우
	if($row['snd_idx'] == $session->getString("userno") && $session->getString("userno")  != ''){
		$title1 = "받는사람";
	}else{
		$title1 = "보낸사람";
	}
?>
<!DOCTYPE html PUBLIC "-//W3C//DTD XHTML 1.0 Transitional//EN" "http://www.w3.org/TR/xhtml1/DTD/xhtml1-transitional.dtd">
<html xmlns="http://www.w3.org/1999/xhtml">
<head>
<meta http-equiv="Content-Type" content="text/html; charset=utf-8" />
<title>쪽지보내기</title>
<link href="/css/layout.css" type="text/css" rel="stylesheet" />
</head>
<body class="pop">

<p class="poptitle"><span>쪽지보내기</span></p>
    <div class="memoplace">
    	<form name="msgwForm" method="post">
    		<input type="hidden" name="mode" value="send">
        <table cellpadding="0" cellspacing="1" border="0" class="bbsTable">
          <colgroup>
          <col width="120px" />
          <col width="*" />
          </colgroup>
          <tr>
            <th><?=$title1?></th>
            <td> <?=$row['snd_id']?></td>
          </tr>
           <tr>
            <th>보낸일자</th>
            <td> <?=$row['snd_dt']?></td>
          </tr>
          <tr>
          	<td colspan="2">
		<div style="height:200px;text-align:left;padding: 3px 5px 3px 5px;"><?=nl2br($row['message'])?> </div>
          	</td>
          </tr>
        </table>
    </form>
        <div class="BtnList">
            	<ul>

                    <li><input type="button" class="btn_cancel" onclick="self.close();" title="닫기"/></li>
                </ul>
            </div>
	</div>
</body>
</html>
